{extend name='common/_container'}
{block name="content"}
<div class="ibox float-e-margins">
<input type="hidden" name='id' id='id' value="{$info.id}" />
	<div class="ibox-content">
		<div class="form-horizontal" id="CodeInfoForm">
			<div class="row" style="margin-top:20px;">
				<div class="form-group">
					<label class="col-sm-2 control-label">承办人：</label>
					<div class="col-sm-9">
						<select lay-ignore name="director_id" class="form-control" id="director_id">
							<option value="">请选择</option>
							{sql query="select  name,user_id from cd_user  where group_id >0"}
							{if condition="$info.director_id>0"}
							<option value="{$sql.user_id}" {if condition="$info.director_id eq $sql.user_id"}selected{/if}>{$sql.name}</option>
							{/if}
							{if condition="$info.director_id==0"}
							<option value="{$sql.user_id}" {if condition="session('admin.userid') eq $sql.user_id"}selected{/if}>{$sql.name}</option>
							{/if}
							{/sql}
						</select>
					</div>
				</div>
				<div class="form-group layui-form">
					<label class="col-sm-2 control-label">介绍人：</label>
					<div class="col-sm-9">
						<?php if(!isset($info['is_introducer'])){ $info['is_introducer'] = 2; } ?>
						<input lay-filter="is_introducer" name="is_introducer" value="1" type="radio" {if condition="$info.is_introducer eq '1'"}checked{/if} title="是">
						<input lay-filter="is_introducer" name="is_introducer" value="2" type="radio" {if condition="$info.is_introducer eq '2'"}checked{/if} title="否">
					</div>
				</div>
				<div class="form-group layui-form introducer" {if condition="$info.is_introducer neq '1'"}style="display: none;"{/if}>
					<label class="col-sm-2 control-label">介绍人：</label>
					<div class="col-sm-9">
						<div class="layui-form-select ySearchSelect y2">
							<div class="layui-input">{$info.introducer}</div>
							<input name="introducer_id" class="form-control layui-input-key" id="introducer_id" type="hidden" value="{$info.introducer_id}">
							<input name="introducer" class="form-control layui-input-val" id="introducer" type="hidden" value="{$info.introducer}">
							<i class="layui-edge"></i>
							<ul>
								{sql query="select id,name from cd_introducer"}
								<li value="{$sql.id}" class="on">{$sql.name}</li>
								{/sql}
								<p>无匹配项</p>
							</ul>
						</div>
					</div>

				<!--					<div class="col-sm-9">-->
<!--						<select lay-ignore name="introducer_id" class="form-control" id="introducer_id">-->
<!--							<option value="0">请选择</option>-->
<!--							{sql query="select id,name from cd_introducer"}-->
<!--							<option value="{$sql.id}" {if condition="$info.introducer_id eq $sql.id"}selected{/if}>{$sql.name}</option>-->
<!--							{/sql}-->
<!--						</select>-->
<!--					</div>-->

				</div>
				<div class="form-group layui-form">
					<label class="col-sm-2 control-label">代管项及改名：</label>
					<div class="col-sm-9">
						银行本：
						<?php if(!isset($info['is_yhb_dg'])){ $info['is_yhb_dg'] = 1; } ?>
						<input name="is_yhb_dg" value="1" type="radio" {if condition="$info.is_yhb_dg eq '1'"}checked{/if} title="是">
						<input name="is_yhb_dg" value="2" type="radio" {if condition="$info.is_yhb_dg eq '2'"}checked{/if} title="否">
						护照：
						<?php if(!isset($info['is_hz_dg'])){ $info['is_hz_dg'] = 2; } ?>
						<input name="is_hz_dg" value="1" type="radio" {if condition="$info.is_hz_dg eq '1'"}checked{/if} title="是">
						<input name="is_hz_dg" value="2" type="radio" {if condition="$info.is_hz_dg eq '2'"}checked{/if} title="否">
						居留证：
						<?php if(!isset($info['is_jlzdg'])){ $info['is_jlzdg'] = 2; } ?>
						<input name="is_jlzdg" value="1" type="radio" {if condition="$info.is_jlzdg eq '1'"}checked{/if} title="是">
						<input name="is_jlzdg" value="2" type="radio" {if condition="$info.is_jlzdg eq '2'"}checked{/if} title="否">
						改名：
						<?php if(!isset($info['is_rename'])){ $info['is_rename'] = 2; } ?>
						<input name="is_rename" value="1" type="radio" {if condition="$info.is_rename eq '1'"}checked{/if} title="是">
						<input name="is_rename" value="2" type="radio" {if condition="$info.is_rename eq '2'"}checked{/if} title="否">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">客户电话：</label>
					<div class="col-sm-9">
						<input type="text" id="mobile" value="{$info.mobile}" name="mobile" class="form-control" placeholder="请输入电话">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">身份证号：</label>
					<div class="col-sm-9">
						<input type="text" id="id_card" value="{$info.id_card}" name="id_card" class="form-control {if condition="$info.id == 0"}id_card{/if}" {if condition="$info.id > 0"} readonly {/if} placeholder="请输入身份证号">
					</div>
				</div>

				<div class="form-group">
					<label class="col-sm-2 control-label">身份证：</label>
					<div class="layui-inline col-sm-9">
						背面 BORA
						<div class="layui-input-inline" style="width: 200px;">
							<input type="text" id="id_card_upside_no" value="{$info.id_card_upside_no}" name="id_card_upside_no" class="form-control" placeholder="请输入身份证反面数字BORA-9.2-02-2560">
						</div>
						背面 JT
						<div class="layui-input-inline" style="width: 200px;">
							<input type="text" id="id_card_upside_two" value="{$info.id_card_upside_two}" name="id_card_upside_two" class="form-control" placeholder="请输入身份证反面数字ME0-1111974-26">
						</div>

					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">姓名宗教：</label>
					<div class="layui-inline col-sm-9">
						名
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" id="first_name" value="{$info.first_name}" name="first_name" class="form-control" placeholder="请输入first_name">
						</div>
						姓
						<div class="layui-input-inline" style="width: 200px;">
							<input type="text" id="last_name" value="{$info.last_name}" name="last_name" class="form-control" placeholder="请输入last_name">
						</div>
						宗教
						<div class="layui-input-inline" style="width: 200px;">
							<input type="text" id="religion" value="{if condition="$info.religion eq ''"}佛教{else}{$info.religion}{/if}" name="last_name" class="form-control" placeholder="请输入宗教">
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">住址：</label>
					<div class="col-sm-9">
						<input type="text" id="addr" value="{$info.addr}" name="addr" class="form-control" placeholder="请输入住址">
					</div>
				</div>

				<div class="form-group">
					<label class="col-sm-2 control-label">在台工作：</label>
					<div class="layui-inline col-sm-9">
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" id="work_year" value="{$info.work_year}" name="work_year" class="form-control" placeholder="请输入在台工作年">
						</div>
						年
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" id="work_month" value="{$info.work_month}" name="work_month" class="form-control" placeholder="请输入在台工作月">
						</div>
						月
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" id="work_times" value="{$info.work_times}" name="work_times" class="form-control" placeholder="请输入次数">
						</div>
						次
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">日期：</label>
					<div class="layui-inline col-sm-9">
						出生日期
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" id="birth_day" value="{if condition="$info.birth_day neq ''"}{$info.birth_day|date="Y-m-d"}{/if}" name="birth_day" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" placeholder="请输入身份证出生日">

						</div>
						身份证有效期
						<div class="layui-input-inline" style="width: 100px;">
							<input type="text" id="expiry_date" value="{if condition="$info.expiry_date neq ''"}{$info.expiry_date|date="Y-m-d"}{/if}" name="expiry_date" class="form-control" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" placeholder="请输入身份证有效期">
						</div>
					</div>
				</div>

				<div class="form-group layui-form">
					<label class="col-sm-2 control-label">身份证图：</label>
					<div class="col-sm-6">
						<input type="text" id="idcardimg" value="{$info.idcardimg}" name="idcardimg"  class="form-control" placeholder="">
						<div class="idcardimg pic_list"></div>
						<div style="clear:both"></div>
						<span class="help-block m-b-none idcardimg_process"></span>
					</div>
					<div class="col-sm-1" style="padding-left:0; padding-right:0">
						<span id="idcardimg_upload"></span>
					</div>
				</div>
				<div class="form-group layui-form">
					<label class="col-sm-2 control-label">身份证图反面：</label>
					<div class="col-sm-6">
						<input type="text" id="idcardimgel" value="{$info.idcardimgel}" name="idcardimgel"  class="form-control" placeholder="">
						<div class="idcardimgel pic_list"></div>
						<div style="clear:both"></div>
						<span class="help-block m-b-none idcardimgel_process"></span>
					</div>
					<div class="col-sm-1" style="padding-left:0; padding-right:0">
						<span id="idcardimgel_upload"></span>
					</div>
				</div>
				<div class="form-group layui-form">
					<label class="col-sm-2 control-label">银行本图：</label>
					<div class="col-sm-6">
						<input type="text" id="bankimg" value="{$info.bankimg}" name="bankimg"  class="form-control" placeholder="">
						<div class="bankimg pic_list"></div>
						<div style="clear:both"></div>
						<span class="help-block m-b-none bankimg_process"></span>
					</div>
					<div class="col-sm-1" style="padding-left:0; padding-right:0">
						<span id="bankimg_upload"></span>
					</div>
				</div>
				<div class="form-group layui-form">
					<label class="col-sm-2 control-label">护照及其他：</label>
					<div class="col-sm-6">
						<input type="text" id="wjbhzimg" value="{$info.wjbhzimg}" name="wjbhzimg"  class="form-control" placeholder="">
						<div class="wjbhzimg pic_list"></div>
						<div style="clear:both"></div>
						<span class="help-block m-b-none wjbhzimg_process"></span>
					</div>
					<div class="col-sm-1" style="padding-left:0; padding-right:0">
						<span id="wjbhzimg_upload"></span>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="hr-line-dashed"></div>
	<div class="row btn-group-m-t">
		<div class="col-sm-9 col-sm-offset-1">
			<button type="button" class="btn btn-primary" onclick="{if condition="$info.id neq ''"}CodeInfoDlg.update(){else/}CodeInfoDlg.add(){/if}" id="ensure">
				<i class="fa fa-check"></i>&nbsp;确认提交
			</button>
			<button type="button" class="btn btn-danger" onclick="CodeInfoDlg.close()" id="cancel">
				<i class="fa fa-eraser"></i>&nbsp;取消
			</button>
		</div>
	</div>
</div>
<style>
	/*带搜索的下拉框 - 开始*/
	.ySearchSelect{
		height: 32px;
		position: relative;
	}
	.ySearchSelect i.layui-edge{
		z-index: 1;
	}
	.ySearchSelect i.select{
		-webkit-transform: rotate(180deg);
		-o-transform: rotate(180deg);
		-moz--transform: rotate(180deg);
		transform: rotate(180deg);
		margin-top: -8px;
	}
	.ySearchSelect .layui-input{
		line-height: 32px;
		position: relative;
		z-index: 1;
	}
	.ySearchSelect .input-text{
		line-height: 32px;
		position: absolute;
		top: 31px;
		left: 1px;
		z-index: 3;
		display: none;
		background-color: #FFF;
	}
	.ySearchSelect .input-text input{
		width: 96%;
		margin-left: 2%;
		height: 36px;
		line-height: 36px;
	}
	.ySearchSelect .input-text .iconfont{
		line-height: 36px;
		color: #999;
		position: absolute;
		top: 0px;
		right: 4%;
		z-index: 2;
	}
	.ySearchSelect ul{
		display: none;
		width: 100%;
		max-height: 228px;
		position: relative;
		top: 0px;
		z-index: 2;
		background-color: #fff;
		border: 1px solid #d2d2d2;
		border-top: 0;
		margin-top: -1px;
		padding: 5px 0;
		padding-top: 36px;
		overflow-x: hidden;
		overflow-y: auto;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
	}
	.ySearchSelect ul li{
		width: 100%;
		height: 36px;
		line-height: 36px;
		padding: 0 10px;
		cursor: pointer;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.ySearchSelect ul li.active{
		background-color: #009688 !important;
		color: #FFF;
	}
	.ySearchSelect ul p{
		width: 100%;
		height: 36px;
		line-height: 36px;
		text-align: center;
		padding: 0 10px;
		color: #999;
		cursor: pointer;
		-webkit-box-sizing: border-box;
		-moz-box-sizing: border-box;
		box-sizing: border-box;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.ySearchSelect ul li.on{
		display: block;
	}
	.ySearchSelect ul li.hide{
		display: none;
	}
	.ySearchSelect ul li:hover{
		background-color: #f0f0f0;
	}
	/*带搜索的下拉框 - 结束*/
</style>
<link href='__PUBLIC__/static/css/viewer.css' rel='stylesheet'/>
<script src="__PUBLIC__/static/js/admin/record/Content.js?t=<?php echo rand(1000,9999)?>" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/upload.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/viewer.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/viewpic.js" charset="utf-8"></script>

<script src="__PUBLIC__/static/js/plugins/layui/layui.js?t=1498856285724" charset="utf-8"></script>
<link rel='stylesheet' href='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.css'>
<script type='text/javascript' src='__PUBLIC__/static/js/plugins/tagsinput/tagsinput.min.js'></script>
<link href='__PUBLIC__/static/js/plugins/chosen/chosen.min.css' rel='stylesheet'/>
<script src='__PUBLIC__/static/js/plugins/chosen/chosen.jquery.js'></script>
<script src="__PUBLIC__/static/js/pinyin.js" charset="utf-8"></script>
<script src="__PUBLIC__/static/js/ySearchSelect.js" charset="utf-8"></script>
<script>
layui.config({dir: '__PUBLIC__/static/js/plugins/layui/'});
	layui.use(['form'], function () {
	form = layui.form();
	var $ = layui.jquery;

	form.on('checkbox(checkpic)',function(data){
		if(data.elem.checked){
			var ajax = new $ax(Feng.ctxPath + "/Record.Customer/getThumbPic", function (data) {
				if(data.status == '00'){
					$("#pic").val(data.imgurl);
				}
			});
			ajax.start();
		}
	});
	form.on('radio(is_introducer)', function(data){
		console.log(data.value); //被点击的radio的value值
		if(data.value!=1) {
			$(".introducer").hide();
			//$(".introducer_mobile").hide();
			//$("#jsrbankimgdiv").hide();
		} else {
			$(".introducer").show();
			//$(".introducer_mobile").show();
			//$("#jsrbankimgdiv").show();
		}
	});

	$(".id_card").blur(function(){
		var id_card =$.trim($(this).val());
		var html='<small class="help-block" id="id_card_exist" style="display: none;">该客户已经存在</small>';
		$(this).parent().append(html);
		if(id_card!=''){
				$.post("{:url('admin/Record.Customer/checkIdCard')}",{id_card:id_card},function(result){
				if(result.status!='00'){
					$("#id_card_exist").show();
					$("#id_card").next().removeClass('glyphicon-ok').addClass('glyphicon-remove');
					$("#id_card").parent().parent().removeClass('has-success').addClass('has-error');
					// Feng.info('该客户已存在');
				}
			});
		}
	});

	$(".id_card").keyup(function(){
		var flag=false;
		$(this).nextAll('small').not('#id_card_exist').each(function(){
			if($(this).is(':visible')){
				flag=true;
			}
		})
		if(flag){
			$("#id_card_exist").hide();
		}
	});

});
layui.use('element', function(){
	var element = layui.element();
	element.on('tab(test)', function(elem){
	});
});


//多图上传
var images = $("#idcardimg").val();
var images1 = $("#idcardimgel").val();
var images2 = $("#bankimg").val();
var images3 = $("#wjbhzimg").val();
//var images4 = $("#jsrbankimg").val();
default_value = getDefaultVal(images);
default_value1 = getDefaultVal(images1);
default_value2 = getDefaultVal(images2);
default_value3 = getDefaultVal(images3);
//default_value4 = getDefaultVal(images4);
uploader('bankimg_upload','bankimg','image',true,default_value2,'{:url("admin/Upload/uploadImages")}');
uploader('wjbhzimg_upload','wjbhzimg','image',true,default_value3,'{:url("admin/Upload/uploadImages")}');
uploader('idcardimg_upload','idcardimg','image',true,default_value,'{:url("admin/Upload/uploadImages")}');
uploader('idcardimgel_upload','idcardimgel','image',true,default_value1,'{:url("admin/Upload/uploadImages")}');
//uploader('jsrbankimg_upload','jsrbankimg','image',true,default_value4,'{:url("admin/Upload/uploadImages")}');
function getDefaultVal(images) {
	var default_value;
	var images = images.substr(0,images.length-1);

	if(images !== ''){
		var images_value;
		if(images.indexOf("|") == -1){
			images_value = '["'+images+'"]';
		}else{
			images_value = JSON.stringify(images.split("|"));
		}
		default_value = images_value;
	}else{
		default_value = '';
	}
	return default_value;
}

$(function(){
	layui.config({dir: '__PUBLIC__/static/js/plugins/layui/'});
		layui.use(['layer', 'form'], function () {
		window.layer = layui.layer;
		form = layui.form();
		form.render();
	});
	$('.filelist').viewer();
	$(".y2").ySearchSelect(); //调用自定义 高亮插件

})



</script>


{/block}
